// 桌面程序总线程序

import 'package:flutter/material.dart';
import 'package:project_award_statistics/pages/desktop_adwaita/change_passwd_page/change_passwd_page.dart';
import 'package:project_award_statistics/pages/desktop_adwaita/login_page/login_page.dart';
import 'package:project_award_statistics/pages/desktop_adwaita/middle_page/middle_page.dart';
import 'package:project_award_statistics/pages/desktop_adwaita/register_page/register_page.dart';
import 'package:project_award_statistics/pages/desktop_adwaita/welcome_page/welcome_page.dart';
import 'package:project_award_statistics/utils/load_award_info_from_db/load_award_info.dart';
import 'package:provider/provider.dart';
import 'package:window_manager/window_manager.dart';
import 'package:yaru/settings.dart';

void main() async
  {
    WidgetsFlutterBinding.ensureInitialized();   // 确保程序主窗口已加载
    // 设置窗口参数
    WindowManager.instance.setTitle("西北民族大学个人奖项查询软件");
    // 设置窗口最小大小
    WindowManager.instance.setMinimumSize(const Size(1360,760));
    runApp(
      ChangeNotifierProvider(   //创建并启动监听控件变化对象,在用户获奖列表发生变化后列表能及时做出变化         
        create:(context)=>DBProvider_AwardInfo(),
        child: const MyApp(),
      ),
    );
  }  

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return YaruTheme(    // 初始化Cannonical Ubuntu做的Yaru主题
      builder:(context, yaru, child) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,  // 关闭右上角DEBUG提示图片
          theme: yaru.theme,   // 使用yaru主题
          darkTheme: yaru.darkTheme,
          home: WelcomePage_Desktop(),
          routes: {
            '/login_page':(context)=>LoginPage_Desktop(),
            '/register_page':(context)=>RegisterPage_Desktop(),
            '/change_passwd_page':(context)=>ChangePasswdPage_Desktop(stu_name:"",),    // 反正等下登录时会传入变量,不会引起报错      
            '/middle_page':(context)=>MiddlePage_Desktop(stu_name:"",),   // 反正等下登录时会传入变量,不会引起报错
          },
        );
      }
    );
  }
}


/* 草稿:
return MaterialApp(   //如果是,那就使用Material Design设计
      debugShowCheckedModeBanner: false,  //关闭右上角DEBUG提示图片
      theme:lightMode,
      home: LoginPage_Mobile(),   
      routes:   //设置整个程序的页面路由跳转
        {
          '/login_page':(context) => LoginPage_Mobile(),              //设置"登录"界面路由名称
          '/home_page':(context) => HomePage_Mobile(stu_name:"-1",),                //设置"主界面"路由名称,由于stuname在跳转主页后会直接获取,所以这里直接给"-1"不会出现运行问题    
          '/profile_edit_page':(context) => ProfileEdit_Mobile(stu_name:"-1",),          //设置"获奖记录"页面路由名称,由于stuname在跳转主页后会直接获取,所以这里直接给"-1"不会出现运行问题                         
          '/about_page':(context) => AboutPage_Mobile(),              //设置"关于"界面的路由名称
          '/register_page':(context)=>RegisterPage_Mobile(),          //设置"用户注册"界面路由名称
        },
    );
*/
